package com.wtb.javatool.service.impl;

import com.wtb.javatool.dao.MajorMapper;
import com.wtb.javatool.entity.Major;
import com.wtb.javatool.service.IMajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MajorService implements IMajorService {

    @Autowired
    private MajorMapper majorMapper;

    @Override
    public List<Major> listAll() {
        return majorMapper.listAll();
    }

    @Override
    public List<Major> findMajorByMajorName(Major major) {
        return majorMapper.findMajorByMajorName(major);
    }

    //禁用
    @Override
    public void disableMajor(Major major){
        major.setDisabled(1);
        majorMapper.updateMajorDisabled(major);
    }

    //解禁
    @Override
    public void unDisableMajor(Major major) {
        major.setDisabled(0);
        System.out.println("执行unDisabledMajor()");
        majorMapper.updateMajorDisabled(major);
    }
}
